package com.example.mybatis_demo.service;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;

/**
 * @className: Solution
 * @author: 芃
 * @description:
 * @date: 2025/2/12 14:06
 */
class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;
    public TreeNode(int val) {
        this.val = val;
    }
}
public class Solution {
    public ArrayList<ArrayList<Integer>> Print (TreeNode pRoot) {
        ArrayList<ArrayList<Integer>> result=new ArrayList<>();
        if (pRoot==null){
            return result;
        }
        Queue<TreeNode> queue=new LinkedList<>();
        queue.offer(pRoot);
        boolean flag=false;
        while (!queue.isEmpty()) {
            ArrayList<Integer>layerList=new ArrayList<>();
        }
        int size=queue.size();
        for (int i=0;i<size;i++){
            TreeNode node=queue.poll();
            layerList.add(node.val);
            if (node.left!=null){
                queue.offer(node.left);

            }
            if (node.right!=null){
                queue.offer(node.right);
            }
        }
        return result;
    }
}
